<?php

if(!empty($_POST))
{
	$file='';
	$thumb='';
	if(!empty($_FILES['file']['name']))
	{
		$file = upload($_FILES['file']);
		$thumb = upload($_FILES['thumb']);	
	}
	
	$_POST['time'] = time();
	$_POST['file'] = $file;
	$_POST['thumb'] = $thumb;
	$re = insert('news', $_POST);
	if($re)
	{
		echo '10086';
//		header('Refresh:1;index.php?a=admin&b=news&c=index');
		die;
	}
	else
	{
		echo '10087';
//		header('Refresh:1;index.php?a=admin&b=news&c=add');
		die;
	}	
}
$news = selectAll('news');
$ree = selectAll('newscate');
$cate = getcate($ree);
//print_r($cate);die;
include('app/admin/news/html/add.html');
?>